<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components"
       xmlns:ice="http://www.icesoft.com/icefaces/component"
       >      
    <h:head>
        <title><h:form><h:outputText>User Rollen bearbeiten</h:outputText></h:form></title>
    </h:head>
    <h:body>
        <ui:composition template="WEB-INF/templates/lecture.xhtml">                        
            <ui:define name="content">
                <ice:panelGroup rendered="#{editRoleBean.selectedUser != null}" >
                                <ice:outputText value="User Details" />
                <br />
                <br />
                <table>
                     <tr>
                         <td>Benutzername: </td>
                         <td> #{editRoleBean.selectedUser.username}</td>
                     </tr>
                     <tr>
                         <td>Vorname: </td>
                         <td> #{editRoleBean.selectedUser.firstName}</td>
                     </tr>
                     <tr>
                         <td>Nachname: </td>
                         <td> #{editRoleBean.selectedUser.lastName}</td>
                     </tr>
                     <tr>
                         <td>Matrikelnummer: </td>
                         <td> #{editRoleBean.selectedUser.studentId}</td>
                     </tr>
                     <tr>
                         <td>E-Mail: </td>
                         <td> #{editRoleBean.selectedUser.email}</td>
                     </tr>
                     <tr>
                         <td>Angestrebter Abschluss: </td>
                         <td> #{editRoleBean.selectedUser.aspiredGrade}</td>
                     </tr>
                 </table>
                <h:form>
                    <ice:commandButton value="Zurück"
                                       action="#{editRoleBean.back()}" />
                </h:form>
            </ice:panelGroup>
                <ice:panelGroup rendered="#{editRoleBean.selectedUser eq null}">
                    <h:form>
                        <ice:dataTable value="#{editRoleBean.userTupel}"
                                   var="user"
                                   >
                        <ice:column>
                            <f:facet name="header"><ice:outputText value="Username" /></f:facet>
                            <ice:commandLink value="#{user.user.username}"
                                             action="#{editRoleBean.viewDetails(user.user)}"/>
                        </ice:column>

                        <ice:column>
                            <f:facet name="header"><ice:outputText value="Vorname" /></f:facet>
                            <ice:outputText value="#{user.user.firstName}" />
                        </ice:column>

                        <ice:column>
                            <f:facet name="header"><ice:outputText value="Nachname" /></f:facet>
                            <ice:outputText value="#{user.user.lastName}" />
                        </ice:column>

                        <ice:column>
                            <f:facet name="header"><ice:outputText value="Rolle" /></f:facet>
                            <ice:selectOneMenu value="#{user.role}"
                                               partialSubmit="true">
                                <f:selectItems value="#{editRoleBean.roleItems}" />
                            </ice:selectOneMenu>
                            <ice:outputText value="#{user.role}" />
                        </ice:column>
                    </ice:dataTable>
                    </h:form>
                </ice:panelGroup>
            </ui:define>
        </ui:composition>
    </h:body>
</html>